package com.shmn.gongjiajumain.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shmn.common.utils.PageUtils;
import com.shmn.common.utils.Query;

import com.shmn.gongjiajumain.dao.WorkcellDao;
import com.shmn.gongjiajumain.entity.WorkcellEntity;
import com.shmn.gongjiajumain.service.WorkcellService;


@Service("workcellService")
public class WorkcellServiceImpl extends ServiceImpl<WorkcellDao, WorkcellEntity> implements WorkcellService {

    @Autowired
    WorkcellDao workcellDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<WorkcellEntity> page = this.page(
                new Query<WorkcellEntity>().getPage(params),
                new QueryWrapper<WorkcellEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<Integer> getIdByWorkcell(String workcell) {
        return workcellDao.getIdByWorkcell(workcell);
    }

    @Override
    public String getWorkCellById(Integer id) {
        return baseMapper.selectById(id).getWorkcell();
    }
}